home *** CD-ROM | disk | FTP | other *** search
/ PC Open 103 / PC Open 103 CD 1.bin / CD1 / INTERNET / WEBDESIGN / Tsw WebCoder / tswwebcoder5en.exe / {app} / scripts / scriptcode / TSW Demo Scripts / events.tss next >
Encoding:
Text File  |  2004-05-11  |  815 b   |  28 lines

  1. {
  2. [Scriptsettings]
  3. Scriptname=Demonstrate how to make event hooks
  4. ExecuteOnStartup=0
  5. ExecuteOnlyOnce=1
  6. RequiresOwnScripterInstance=1
  7. }
  8. program EventDemo;
  9.  
  10. procedure EditorMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  11. begin
  12.  If Button = mbRight then
  13.   ShowMessage('You just clicked the right mousebutton!');
  14. end;
  15.  
  16. procedure EditorKeyPress(Sender: TObject; Key: char);
  17. begin
  18.  If Key = 'w' then
  19.   ShowMessage('You just pressed the "w" key!');
  20. end;
  21.  
  22. begin
  23.  Editor.OnMouseUp := 'EditorMouseUp';
  24.  Editor.OnKeyPress := 'EditorKeyPress';
  25.  ShowMessage('Events have been assigned. Try clicing in the editor area with the right mousebutton, or pressing the "w" key.');
  26.  ShowMessage('Select "Unhook script events" from the Scripts menu, to disable this.'); 
  27. end;
  28.